﻿<!--
	@create by 
	@update by 
	@description 
-->

<div>
    <el-form-q :field-data="queryFields" :buttons="queryButtons"></el-form-q>
    <div class="yu-toolBar">
        <el-button-group>
            <el-button icon="plus" @click="addFn" v-if="checkPermission('create')">新增</el-button>
            <el-button icon="edit" @click="modifyFn" v-if="checkPermission('edit')">修改</el-button>
            <el-button icon="document" @click="infoFn" v-if="checkPermission('detail')">查看</el-button>
            <el-button icon="yx-bin" @click="deleteFn" v-if="checkPermission('delete')">注销</el-button>
            <el-button icon="yx-file-excel" @click="exportFn" v-if="checkPermission('export')">导出</el-button>
            <el-button icon="document" @click="uploadAnnexFile" v-if="checkPermission('supervision')">合作方材料管理</el-button>
        </el-button-group>
    </div>

    <el-table-x ref="reftable" :row-index="true" :base-params="baseParams"
                :data-url="dataUrl" :table-columns="tableColumns" :request-type="'POST'"></el-table-x>

    <!-- 说明dialog可配置宽高属性，若不配置则宽度默认为屏幕50%，高度自适应
       width="650px" height="380px" -->
    <!--<el-dialog-x :title="viewTitle[viewType]" :visible.sync="dialogVisible" width="650px">-->
    <!--<el-form-x ref="reform"-->
    <!--:group-fields="updateFields" :buttons="updateButtons"-->
    <!--:disabled="formDisabled" label-width="80px"></el-form-x>-->
    <!--</el-dialog-x>-->

    <el-dialog-x :visible.sync="dialogVisible" size="full" label-width="60px" >
        <el-tabs type="border-card" v-model="baseTab">
            <el-tab-pane label="合作方信息" name="baseTab" >

                <el-collapse ref='basecollapse' v-model="expandCollapseName" >

                    <el-collapse-item title="合作方基本信息" name="partnerInfo">
                        <el-form-x ref="partnerInfo" :group-fields=" partnerInfoFields" :disabled="formDisabled" label-width="130px" id="from"></el-form-x>
                    </el-collapse-item>

                    <el-collapse-item title="合作信息" name="cooperationInfo">
                        <el-form-x ref="cooperationInfo" :group-fields="cooperationInfoFields" :disabled="formDisabled" label-width="130px" id="from"></el-form-x>
                    </el-collapse-item>

                    <el-collapse-item title="联系信息" name="relationInfo">
                        <el-form-x ref="relationInfo" :group-fields="relationInFoFields" :disabled="formDisabled" label-width="130px" id="from"></el-form-x>
                    </el-collapse-item>
                    <!--<el-collapse-item title="合作方材料" name="partnerMat" >
                           <el-button >上传</el-button>
                           <el-button >下载</el-button>
                           <el-button >查看</el-button>
                           <el-button >删除</el-button>
                        &lt;!&ndash;<div class="yu-grpButton">&ndash;&gt;
                            &lt;!&ndash;<el-button type="primary" icon="yx-undo2" @click="saveFn" >保存</el-button>&ndash;&gt;
                            &lt;!&ndash;<el-button type="primary" icon="yx-undo2" @click="cancleFn" >返回</el-button>&ndash;&gt;
                        &lt;!&ndash;</div>&ndash;&gt;
                    </el-collapse-item>

                    <el-collapse-item title="合作方材料" name="partnerMatInfo">
                            <el-button >查看</el-button>

                    </el-collapse-item>-->

                </el-collapse>
                <div class="yu-grpButton">
                    <el-button type="primary" icon="check" @click="saveFn" v-if="viewType != 'DETAIL'">保存</el-button>
                    <el-button type="primary" icon="yx-undo2" @click="cancleFn" v-if="viewType != 'DETAIL'">取消</el-button>
                    <el-button type="primary" icon="yx-undo2" @click="cancleFn" v-if="viewType == 'DETAIL'">返回</el-button>
                </div>
            </el-tab-pane >
            <el-tab-pane label="合作方关联产品" name="secondTab"> <!--v-if="viewType == 'DETAIL'"-->
                <div class="yu-toolBar" >
                    <el-button-group>
                        <el-button icon="yx-plus" @click="productAddFn" v-if="viewType != 'DETAIL'">新增</el-button>
                        <el-button icon="yx-bin" @click="productDelFn" v-if="viewType != 'DETAIL'">删除</el-button>
                    </el-button-group>
                </div>

                <el-table-x ref="partnerRelPro" :row-index="true" :base-params="partnerRelProParams" v-if="viewType != 'ADD'"
                            :data-url="dataUrlPartnerRelPro" :table-columns="tableColumnsPartnerRelPro" :request-type="'POST'">
                </el-table-x>
                <el-table-x ref="faker" :row-index="true" v-if="viewType == 'ADD'"
                             :table-columns="tableColumnsPartnerRelPro">
                </el-table-x>
                <div class="yu-grpButton">
                    <el-button type="primary" icon="yx-undo2" @click="cancleFn" >返回</el-button>
                </div>

                <!-- 产品增加弹框 -->
                <el-dialog-x title="增加" :visible.sync="relProDialogVisible" width="650px">
                    <el-form-x ref="proAddRef" :group-fields="relationInFoFieldsII"  ></el-form-x>
                    <div class="yu-grpButton">
                        <el-button type="primary" icon="yx-undo2" @click="proBackFn" >返回</el-button>
                        <el-button type="primary" icon="check" @click="proSaveFn" >保存</el-button>

                    </div>
                </el-dialog-x>
            </el-tab-pane>
        </el-tabs>
        <!--<div>-->
        <!--<el-form-q ref="reform" :buttons="updateButtons" :disabled="formDisabled"></el-form-q>-->
        <!--</div>-->
    </el-dialog-x >

    <el-dialog-x title="提示" :visible.sync="exportDialogVisible" width="350px" height="80px">
        <div>
            <div style="margin: 5px;">是否导出文件：{{ exportFileName + '.xlsx'}}</div>
            <div id="exportSpan" style="margin: 10px; text-align: right"></div>
        </div>
    </el-dialog-x>

    <el-dialog-x title="合作方材料管理" :visible.sync="uploadDialogVisible" size="full" label-width="60px">
        <div class="yu-toolBar">
            <el-button-group>
                <el-button icon="plus" @click="uploadAnnexFn" >上传</el-button>
                <el-button icon="document" @click="infoAnnexFn">查看</el-button>
            </el-button-group>
        </div>
        <el-table-x ref="reftableAnnex"  :base-params="baseParamsAnnex"
                    :data-url="dataUrlAnnex" :table-columns="tableColumnsAnnex" :request-type="'POST'" >
        </el-table-x>
        <div class="yu-grpButton">
        <el-button type="primary" icon="yx-undo2" @click="updateBackFn" >返回</el-button>
        </div>
    </el-dialog-x>

    <el-dialog-x title="附件" :visible.sync="dialogVisibleAnnex" size="large">
        <el-form-x ref="annexForm" :group-fields="annexInfoFields" :disabled="annexFormDisabled"
                   label-width="130px" style="padding: 12px 12px 24px 12px">
        </el-form-x>
        <div class="yu-grpButton">
            <el-button type="primary" @click="saveAnnexFn" icon="check" v-if="flag != 'VIEWINFO'">保存</el-button>
            <el-button type="primary" @click="cancleAnnesFn" icon="yx-undo2" v-if="flag != 'VIEWINFO'">取消</el-button>
            <el-button type="primary" @click="cancleAnnesFn" icon="check" v-if="flag == 'VIEWINFO'">返回</el-button>
        </div>
    </el-dialog-x>
</div>
